package cn.tannn.ops.quartz.job;

import cn.tannn.ops.quartz.annotation.Job;
import cn.tannn.ops.quartz.annotation.JobMeta;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.Trigger;
import org.springframework.scheduling.quartz.QuartzJobBean;
import org.springframework.stereotype.Component;

/**
 * 测试用的
 * @see https://www.yuque.com/tanning/yg9ipo/bnug8bglppneik2r#qeIdb
 * @author <a href="https://t.tannn.cn/">tan</a>
 * @version V1.0
 * @date 2024/8/27 上午9:36
 */
@Slf4j
@Component
@Job(cron = "0 15 0 * * ?", jobName = "TestQuartzJobBean", isStartNow = false)
@JobMeta(name = "demo",description = "测试用的")
public class TestJob  extends QuartzJobBean {
    @Override
    protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
        Trigger trigger = context.getTrigger();
        JobDetail jobDetail = context.getJobDetail();
        log.info("定时开始trigger：{}, job: {}",trigger.getKey(),jobDetail.getKey());
    }
}
